import request from '@/utils/request';
import moment from 'moment'

// 遗失物品报废管理分页列表
export async function scrapPageList(data) {

  if (!data.yearMonth) {
    data.yearMonth = 'all'
  } else {
    data.yearMonth = moment(data.yearMonth).format('YYYYMM')
  }

  return request('/luggage/lost/articles/scrapPageList/' + data.yearMonth, {
    method: 'post',
    data
  });
}


// 添加报废物品
export function addScrap(yearMonth) {
  return request('/luggage/lost/articles/addScrap/' + yearMonth, {
    method: 'get'
  });
}

// 删除遗失物品报废单
export function deleteScrapLostForm(params) {
  return request('/luggage/lost/articles/deleteScrapLostForm', {
    method: 'post',
    params
  });
}

// 报废单下的待报废遗失物品分页列表
export function awaitScrapArticlesPageList(data) {
  return request('/luggage/lost/articles/awaitScrapArticlesPageList/' + data.scrapNumber, {
    method: 'post',
    data
  });
}

// 确认报废遗失物品
export function confirmScrap(data) {
  return request('/luggage/lost/articles/confirmScrap', {
    method: 'post',
    data
  });
}

// 报废单下的报废物品导出
export function scrapProductsUnderScrapList(params) {
  return request('/luggage/lost/articles/scrapProductsUnderScrapList/' + params.scrapNumber + '/' + params.type + '/export', {
    method: 'get',
    responseType: "blob"
  });
}

// 遗失物品报废单结案
export function closeScrapLostForm(params) {
  return request('/luggage/lost/articles/closeScrapLostForm', {
    method: 'post',
    params
  });
}